#ifndef CENTRALTABWIDGET_H
#define CENTRALTABWIDGET_H

#include "BaseTabWidget/BaseTabWidget.h"
#include "Macros.h"

class CentralTab;
class CentralTabBar;

class CentralTabWidget : public BaseTabWidget {
    Q_OBJECT
public:
    explicit CentralTabWidget(QWidget *parent = nullptr);
    ~CentralTabWidget();

private:
    typedef BaseTabWidget Super;

public:
    int addTab(CentralTab *tab);
    int insertTab(int index, CentralTab *tab);

    CentralTab *currentWidget() const;
    CentralTab *tabAt(int index) const;
    int indexOf(CentralTab *tab) const;

    void setCornerWidget(CentralTab *w, Qt::Corner corner = Qt::TopRightCorner);
    CentralTab *cornerWidget(Qt::Corner corner = Qt::TopRightCorner) const;

    void setCurrentWidget(CentralTab *tab);

    void removeTab(int index);
    void removeTab(CentralTab *tab);

    CentralTabBar *tabBar() const;

    CentralTab *currentTab() const;
    CentralTab *previousTab() const;

protected:
    void addTabCore(int index) override;
    void removeTabCore(int index) override;
    void tabIndexChangeCore(int index, bool changed) override;

protected:
    void wheelEvent(QWheelEvent *event) override;
};

#endif // CENTRALTABWIDGET_H
